package drds.binlog.deployer;

import java.text.MessageFormat;

/**
 * 启动常用变量
 */
public class Constants
{

    public static final String mdc_destination = "destination";
    public static final String ROOT = "canal";
    public static final String ID = ROOT + "." + "id";
    public static final String IP = ROOT + "." + "ip";
    public static final String PORT = ROOT + "." + "port";
    public static final String METRICS_PULL_PORT = ROOT + "." + "metrics.pull.port";
    public static final String ZKSERVERS = ROOT + "." + "zkServers";
    public static final String WITHOUT_NETTY = ROOT + "." + "withoutNetty";

    public static final String DESTINATIONS = ROOT + "." + "destinations";
    public static final String AUTO_SCAN = ROOT + "." + "auto.scan";


    public static final String DESTINATION_SPLIT = ",";
    public static final String GLOBAL_NAME = "global";


    public static final String INSTANCE_LAZY_TEMPLATE = ROOT + "." + "instance.{0}.lazy";
    public static final String INSTANCE_MANAGER_ADDRESS_TEMPLATE = ROOT + "." + "instance.{0}.manager.address";

    public static final String SOCKETCHANNEL = ROOT + "." + "socketChannel";


    public static String getInstanceManagerAddressKey(String destination)
    {
        return MessageFormat.format(INSTANCE_MANAGER_ADDRESS_TEMPLATE, destination);
    }


    public static String getInstancLazyKey(String destination)
    {
        return MessageFormat.format(INSTANCE_LAZY_TEMPLATE, destination);
    }
}
